<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="/WEB-INF/config/c.tld" prefix="c" %>
<%@ taglib prefix="fn" uri="/WEB-INF/config/fn.tld" %>
<%@ taglib prefix="fmt" uri="/WEB-INF/config/fmt.tld" %>
<!DOCTYPE HTML>
<html>
<head>
    <title>${infoTypeClassA.name}</title>
</head>
<body>
<ul class="breadcrumb">
    <li>
        <a href="index.html">首页</a> <i class="icon-angle-right"></i>
    </li>
    <li>
        <a href="info/manage/list/${infoTypeClassA.id }.html">信息管理</a>
        <i class="icon-angle-right"></i></li>
    <li>
        <a href="info/manage/initAdd/${infoTypeClassA.id }.html">${infoTypeClassA.name}</a>
        <i class="icon-angle-right"></i>
    </li>
    <li><a href="#">更新信息</a></li>
</ul>
<div class="row-fluid ui-sortable">
    <div class="box span12">
        <div class="box-header" data-original-title>
            <h2>
                <i class="halflings-icon white edit"></i><span class="break"></span>请完善以下信息
            </h2>
            <div class="box-icon">
                <a href="#" class="btn-minimize"><i class="halflings-icon white chevron-up"></i> </a>
            </div>
        </div>
        <div class="box-content">
            <form class="form-horizontal" action="info/manage/save.html" method="post" enctype="multipart/form-data">
                <fieldset>
                    <div class="control-group">
                        <label class="control-label" for="cnName">标题 </label>
                        <div class="controls">
                            <input type="text" class="span10" name="cnName" id="cnName" value="${info.cnName }"
                                   required>
                        </div>
                    </div>
                    <div class="control-group hidden-phone">
                        <label class="control-label" for="textarea2">点击量</label>
                        <div class="controls">
                            <input type="number" class="span10 typeahead" name="volume" value="${info.volume }" />
                        </div>
                    </div>
                    <div class="control-group hidden-phone ">
                        <label class="control-label" for="textarea2">内容</label>
                        <div class="controls">
                            <textarea id="addeditor_id" name="cnContent"
                                      style="width:100%;height:600px;border: 0 none;visibility:hidden;">${info.cnContent }</textarea>


                            <%--<script id="cnContent" name="cnContent" type="text/plain">${info.cnContent }</script>--%>
                        </div>
                    </div>
                    <div class="span12" style="display: none;">
                        <label class="control-label">上传附件</label>
                        <div class="controls">
                            <input class="input-file uniform_on" id="fileInput" name="fileInput" type="file" multiple="multiple" >
                            <img src="${banner.image}" id="imageLeft" style="width:200px;">
                        </div>
                    </div>
                    <div class="form-actions">
                        <button type="submit" class="btn btn-primary">保存信息</button>
                        <input type="hidden" name="infoTypeClassAId" value="${infoTypeClassA.id }"/>
                        <input type="hidden" name="id" value="${info.id }"/>
                    </div>
                </fieldset>
            </form>
        </div>
    </div>
    <!--/span-->
</div>
<script charset="utf-8" src="kindeditor/kindeditor-all.js"></script>
<script charset="utf-8" src="kindeditor/lang/zh-CN.js"></script>
<script type="text/javascript" src="ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="ueditor/ueditor.all.js"></script>


<script type="text/javascript">
    var editor;
    KindEditor.ready(function (K) {
        editor = K.create('textarea[name="cnContent"]', {
            resizeType: 1,
            uploadJson: 'kefileUpload.json',// 上传图片接口  项目名（此处项目名是wenjiqiwu）+上传图片的路径
            filePostName: 'imgFile',// name属性默认值
            allowPreviewEmoticons: false
        });
    });
</script>


<!--/row-->
<script>
    var cnContent = UE.getEditor('cnContent', {
        initialFrameWidth: 740,//设置编辑器宽度
        initialFrameHeight: 350,//设置编辑器高度
        scaleEnabled: true
    });

    $("#fileInput").change(function () {
        var objUrl = getObjectURL(this.files[0]);
        console.log("objUrl = " + objUrl);
        if (objUrl) {
            $("#image").attr("src", objUrl);
        }
    });

    //建立一个可存取到该file的url
    function getObjectURL(file) {
        var url = null;
        if (window.createObjectURL != undefined) { // basic
            url = window.createObjectURL(file);
        } else if (window.URL != undefined) { // mozilla(firefox)
            url = window.URL.createObjectURL(file);
        } else if (window.webkitURL != undefined) { // webkit or chrome
            url = window.webkitURL.createObjectURL(file);
        }

        return url;
    }
</script>
</body>
</html>
